<?php $this->_extends('../_layouts/blank_layout'); ?>
<?php $this->_block('contents'); ?>
<script type="text/javascript" src="<?=Q::ini('custom_system/base_url')?>js/jq.js"></script>
<script type="text/javascript">
$(function(){
	$("#check_all").click(function(){
		if ($(this).is(":checked"))
		{
			$(".checkbox").attr("checked", true);
		}
		else
		{
			$(".checkbox").attr("checked", false);
		}
	});
	$(".keep_quantity").click(function(){
		$(this).parent().parent().find("input[type='checkbox']").attr("checked", true);
	});
	$("#keep_quantity_btn").click(function(){
		$(".keep_quantity").val($("#keep_quantity").val());
		$(".list_table").find("input[type='checkbox']").attr("checked", true);
	});
});
</script>
<p class="red">说明：只能设置FixedPrice且为GTC的在线链接，设置后每天凌晨自动执行维持操作。  <span style="float: right; padding-right: 29px;"><label style="color: black;">批量填维持数  </label><input type="text" id="keep_quantity" size="6" /> <input type="button" value="批量填数" size="7" id="keep_quantity_btn" /></span></p>
<form action="<?=url('Online::EbayListing/KeepQuantitySave')?>" method="post">
<table class="list_table">
<tr>
	<th width="120">店铺</th>
	<th width="130">Item ID</th>
	<th width="120">SKU</th>
	<th width="120">Price</th>
	<th width="100">当前在线数</th>
	<th>维持的数量</th>
	<th width="50">设置维持</th>
</tr>
<?foreach ($listing as $l):?>
<?foreach ($l as $k => $li):?>
<tr>
	<?if ($k == 0):?>
	<td rowspan="<?=count($l)?>"><?=$li['shop_name']?></td>
	<td rowspan="<?=count($l)?>"><?=$li['item_id']?></td>
	<?endif;?>
	<td><?=$li['sku']?></td>
	<td><?=$li['currency_symbol']?> <?=$li['start_price']?></td>
	<td><?=$li['quantity']?></td>
	<td><input type="text" name="item[<?=$li['id']?>][keep_quantity]" value="<?=$li['keep_quantity']?>" size="5" class="keep_quantity" /></td>
	<td><input class="checkbox" type="checkbox" name="item[<?=$li['id']?>][keep_quantity_flag]" value="<?=$li['keep_quantity_flag']?>" <?if ($li['keep_quantity_flag'] == Q::ini('custom_flag/online_ebay_listing_item_keep_quantity_flag/keep/value')):?>checked="checked"<?endif;?> /></td>
</tr>
<?endforeach;?>
<?endforeach;?>
<tr>
	<td colspan="6"></td>
	<td><label><input type="checkbox" id="check_all"/>全选</label></td>
</tr>
</table>
<input type="hidden" name="<?=Q::ini('unique_token_name')?>" value="<?=Helper_BSS_Normal::genToken()?>" />
<input type="submit" value="保存" class="button" />
</form>
<?php $this->_endblock();?>